﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace MenuGame2DXNA
{
    public class sInputName : Scene
    {
        TextBox textbox;
        Dialog dialog;
         KeyboardState oldState;
         Game game;
        public override void LoadContent(Game _game)
        {
            game = _game;
            base.LoadContent(game);
            textbox = new TextBox(game);
            textbox.PositionStart = new Vector2(250, 200);
            textbox.ColorText = Color.Yellow;
            textbox.Scale = 1.5f;
            dialog = new Dialog(game, 600, 400, textbox, "INPUT YOUR NAME");
            Stop();
        }
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
             if (!isPlayMusic)
            {
                MusicManager.Play("Title");
                isPlayMusic = true;
            }
             KeyboardState kbState = Keyboard.GetState();
             if (kbState.IsKeyDown(Keys.Escape))
             {
                 game.Scene = 0;
                 Stop();
             }
             if (kbState.IsKeyDown(Keys.Enter))
             {
                 
                 Stop();
             }
            dialog.Update(gameTime, Color.White);
        }
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            
            base.Draw(gameTime, spriteBatch);
            dialog.Draw(gameTime, spriteBatch);
        }
        public override void Play()
        {
            dialog.Appear(54);
            base.Play();
        }
        public override void Stop()
        {
            dialog.DisAppear(1);
            base.Stop();
        }
      
    }

}
